package xyz.heyaoshare.config.knife4j;

import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Knife4j(Swagger)配置类
 * @author YueHe
 * @version 0.0.1
 * @since 2025/6/25 上午10:58
 */
@Configuration
public class knife4jConfig {

    @Bean
    public GroupedOpenApi userApi() {
        String[] paths = {"/**"};
        String[] packagedToMatch = {"xyz.heyaoshare.core"};
        return GroupedOpenApi.builder().group("v 1.0.0").pathsToMatch(paths).packagesToScan(packagedToMatch).build();
    }

    @Bean
    public OpenAPI customOpenAPI() {
        Contact contact = new Contact();
        contact.setName("--");
        return new OpenAPI()
                .info(new Info().title("spring-boot-cli").version("v 0.0.1").termsOfService("服务条款").description("spring-boot-cli脚手架API文档")
                        .license(new License().name("Apache 2.0").url("https://www.apache.org"))
                        .contact(new Contact().name("--").email("xxx@qq.com").url("联系主页")));
    }

}